<include file="common:__head__"/>
<div class="money_recharge">
    <p class="recharge_p">
        <input type="hidden" id="agent_id" value=/>
        {$agent['agent_name']}：当前余额<a class="amt">￥{$agent['money']}</a>元
    </p>
    <p class="recharge_p">
        <select id="do_type">
            <option value="1">加</option>
            <option value="2">减</option>
        </select>
        <input type="text" data-type="number" name="amt" required id="amt" value="0"/>
        <a class="btn-lg btn-blue" id="submitBtn" style="height:30px;line-height:30px;">保存</a>
    </p>
</div>
<script type="text/javascript">
    $(function(){
        $('#submitBtn').click(function () {
            var amt = $("#amt").val();
            var do_type = $("#do_type").val();
            if(!amt){
                layer.alert("金额未填写");return false;
            }
            $.ajax({
                type : "POST",
                url:"{:U('Agent/money_edit')}",
                data : {
                    amt :amt,
                    do_type :do_type,
                    agent_id :"{$agent['agent_id']}"
                },
                success: function(data){
                    if(data.status == "success"){
                        layer.msg("充值成功" ,{time: 1500});
                        setTimeout(function(){
                            location.reload(true);
                        }, 1500);
                    }else{
                        layer.msg(data.msg ,{time: 1500});
                    }
                }
            });
        });
    });
</script>
<include file="common:__foot__"/>